/**
 * 
 */
package com.devmindset.legoframework.client.mvc.util;

import com.allen_sauer.gwt.log.client.Log;
import com.devmindset.legoframework.client.mvc.LegoComponent;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Dialog;


/**
 * Information dialog displayed to the user when some uncaught exception occurs
 * while building {@link LegoComponent}s.
 * 
 * @author <a href="mailto:ice.penov@devmindset.com">Ice Penov</a>
 */
public final class ErrorDialog {
  
	/**
	 * No public instantiation; static usage only.
	 */
  private ErrorDialog() {
    ;
  }
  
  /**
   * Shows the information dialog depicting the error situation.
   * 
   * @param e the exception.
   */
  public static void logAndShow(Throwable e) {
    Dialog d = new Dialog();
    d.setWidth(100);
    Log.error("Uncaught exception occured.", e);
    SC.warn("Uncaught exception occured.", e.toString(), null, d);
  }

}